﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace random
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rand = new Random();
            int[] nums = new int[100];
            for (int i = 0; i < 100; i++)
            {
                nums[i] = rand.Next(1000);
            }
            var m = from i in nums orderby i descending select i;
            Console.WriteLine("生成的一百个随机数为：");
            foreach (var n in m)
            {
                Console.WriteLine(n);
                Console.WriteLine(" ");
            }
            Console.WriteLine("总和为：");
            Console.WriteLine(m.Sum());
            Console.WriteLine("平均数为：");
            Console.WriteLine(m.Average());

            Console.WriteLine("按任意键继续");
            Console.ReadLine();
        }
    }
}